<?php
/**
 * ============================================================================
 * Doxt Version: 1.0           
 * Web: http://www.doxt.com
 * Copyright (C) 2007 - 2010 Doxt Technology Inc., All Rights Reserved.
 * ---------------------------------------------
 * $Date: 2008.4.8
*/
  include_once("./config.php");
  $tpl = new PhplibTpl($conf["admin_tpl_path"]);
  if (! empty($_GET['mode']) )
  {   
    include($conf["include_path"] . $_GET['mode'] . ".php");
  }
  //分类列表文件
  //include($conf["include_path"] . "list_cate.php");  
  $tpl -> set_file("main", "consult.htm");
  $tpl -> set_block("main", "NEWS_LIST", "news_list");
 
  $query = "SELECT * FROM $TBL_CONSULT where hou_type=1";   //没有文章
  
  $btn_sub = $_POST["btn_sub2"]; 
  if ($btn_sub)
  {
	$search_key = work_str( $_POST["search_key"] );  //查找关键字
	if (! empty($search_key))
	{
	  $search_str = " and hou_num like '%" . $search_key . "%'";
      $query .= $search_str;
	} //End if	 	
  } 
  $query_footer = " order by id DESC";
  $query = $query . $query_footer;
  //实现分页
  include( $conf['base_path'] . "lib/make_pages.php");
  $cur_page = (int)$_GET["p"];   //获取当前页
  $url_param = preg_replace("/(p=[0-9]+)&/", "", $_SERVER['QUERY_STRING']);
  $pages = new Pager($query, $cur_page, 15, $url_param);
  $page_string = $pages -> getPageString();   
  $res = $pages -> getRsPerPage();
  while ($rows = mysql_fetch_array($res))
  {    
	$tpl -> set_var(array(						
						"id" => $rows["id"],
						"hou_id"=> $rows["hou_id"],
						"hou_num" =>$rows["hou_num"],
						"mem_id" => $rows['mem_id'],
						"name" =>$rows["name"],
						"consult" => $rows["consult"],
						"time" =>$rows["time"],
						
		                ));
	$tpl -> parse("news_list", "NEWS_LIST", true);
  } //End while
  if (empty($page_string))
    $page_string = "暫無出租房的問題咨詢信息";
  $tpl -> set_var(array(
                        "SEARCH_KEY" => $search_key,
                        "SHOW_CATE" => $show_cate,
						"INIT_CATE" => $init_cate,
                        "PAGE_STRING" => $page_string
                      ));
  $tpl-> set_var( $conf);
  $tpl -> parse("Output", "main");
  $tpl -> p("Output");
  ?>